﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Media.Core.Data;
using Media.Core.Entities;
using Media.Core.Models.Areas.Wizard;

namespace Media.Web.Areas.Setup.Controllers
{

    public class StartController : Controller
    {
        private static MediaEntitiesDataContext db = new MediaEntitiesDataContext();

        public ActionResult Index()
        {
            var WizardBoxInformation = (from w in db.Setup_WizardInfos
                                        orderby w.StepNumber
                                        select new
                                        {
                                            Id = w.Id,
                                            TabTitle = w.TabTitle,
                                            TabSubTitle = w.TabSubTitle,
                                            StepNumber = w.StepNumber,
                                            StepTitle = w.StepTitle,
                                            StepSubTitle = w.StepSubTitle,
                                            StepSubInformation = w.StepSubInformation,
                                            StepMaintitle = w.StepMainTitle,
                                            StepMainInformation = w.StepMainInformation
                                        }).ToArray();

            var WizardContent = new WizardInfoArray();

            foreach (var WizardStep in WizardBoxInformation)
            {
                WizardContent.WizardBox.Add(new WizardInfo
                {
                    Id = WizardStep.Id,
                    TabTitle = WizardStep.TabTitle,
                    TabSubTitle = WizardStep.TabSubTitle,
                    StepNumber = WizardStep.StepNumber,
                    StepTitle = WizardStep.StepTitle,
                    StepSubTitle = WizardStep.StepSubTitle,
                    StepSubInformation = WizardStep.StepSubInformation,
                    StepMainTitle = WizardStep.StepMaintitle,
                    StepMainInformation = WizardStep.StepMainInformation

                });
            }

            return View(WizardContent);
        }

    }
}
